package io.renren.modules.app.controller;

import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping({"app/foo"})
public class TestController
{
  @PostMapping({"/list"})
  private String list(String pageSize, String pageNumber)
  {
    Map map = new HashMap();
    map.put("pageNumber", pageNumber);
    map.put("pageSize", pageSize);
    JSONObject jsonObject = new JSONObject(map);
    return jsonObject.toJSONString();
  }

  @PostMapping({"/list2"})
  private String list2(@RequestBody Map<String, Object> params) {
    Map map = new HashMap();
    map.put("pageNumber", params.get("pageNumber"));
    map.put("pageSize", params.get("pageSize"));
    JSONObject jsonObject = new JSONObject(map);
    return jsonObject.toJSONString();
  }
}